package com.qisu;


import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.stereotype.Component;

import com.qisu.command.CommandList;
import com.qisu.service.SettlementService;
import com.qisu.command.CMD102;
import com.qisu.command.CMD104;
import com.qisu.command.CMD106;
import com.qisu.command.CMD108;
import com.qisu.command.CMD202;
import com.qisu.command.CMD6;
import com.qisu.command.CMD65534;
import com.qisu.command.CMD65535;
import com.qisu.command.CMD8;

/**
 * 
 * @author li
 *
 */
@Component
@Configuration
public class AppInit {

	@Autowired private CommandList cmdList;
	@Autowired private CMD6 cmd6;
	@Autowired private CMD8 cmd8;
	@Autowired private CMD102 cmd102;
	@Autowired private CMD104 cmd104;
	@Autowired private CMD106 cmd106;
	@Autowired private CMD108 cmd108;
	@Autowired private CMD202 cmd202;
	@Autowired private CMD65534 cmd65534;
	@Autowired private CMD65535 cmd65535;
	@Autowired private SettlementService settlementService;
	
	public void run() {
		prepareCommandRepo();
		
	}

	private void prepareCommandRepo() {
		cmdList.addCommand(6, cmd6);
		cmdList.addCommand(8, cmd8);
		cmdList.addCommand(102, cmd102);
		cmdList.addCommand(104, cmd104);
		cmdList.addCommand(106, cmd106);
		cmdList.addCommand(108, cmd108);
		cmdList.addCommand(202, cmd202);
		cmdList.addCommand(65534, cmd65534);
		cmdList.addCommand(65535, cmd65535);
		settlementService.init();
	}

	


}
